<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />


<script src="${pageContext.request.contextPath}/resource/js/jquery/plugin/handlebars-v3.0.1.js"></script>
<script src="${pageContext.request.contextPath}/resource/js/jquery/jquery.form.min.js"></script>
<script src="${pageContext.request.contextPath}/resource/js/bootstrap/js/bootstrap-multiselect.js"></script>
<link href="${pageContext.request.contextPath}/resource/css/def/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/resource/css/customTemplet.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/resource/css/bootstrap-multiselect.css" rel="stylesheet">

<script src="${pageContext.request.contextPath}/resource/js/frm/sys/customTemplet.js"></script>
<script src="${pageContext.request.contextPath}/resource/js/jquery-editable-select.min.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/resource/css/jquery-editable-select.min.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/resource/css/jquery.fileupload.css" />
<script src="${pageContext.request.contextPath}/resource/js/jquery/plugin/datatables/js/jquery.dataTables.js"></script>

<title>源码生成器</title>
</head>

<body>
<!-- Header -->
<div id="header-wrapper">
  <header id="header" class="container">
    <!-- Nav -->
    <nav id="nav">
       <ul>
         <li><a href="#" onclick="toTableList();">源码生成</a></li>
         <li class="current"><a href="#">自定义模板</a></li>
       </ul>
    </nav>
  </header>
</div>

<!-- Main -->
<div id="main-wrapper">
  <div class="container">
    <div class="main">
      <div class="tool-area">
        <div class="floatL">
          <form class="form-inline" role="form">
            <div class="form-group">
              <label>模板名称：</label>
              <input type="text" class="form-control input-sm" name="templetForm" id="templetFormStr" placeholder="模板名称">
            </div>
          </form>
        </div>
        <div class="floatR">
          <button type="button" class="btn btn-primary btn-sm" onclick="searchPageList();">查&nbsp;&nbsp;询</button>
       	  <button type="button" class="btn btn-primary btn-sm" onclick="cleanSelect();">清&nbsp;&nbsp;空</button>
       	  <button type="button" class="btn btn-primary btn-sm" onclick="openMode();">模板上传</button>
        </div>
        <div class="clear"></div>
      </div>
        
        <table id="searchTable" width="100%" height="100%" class="display" cellspacing="0" >
			<thead>
				<tr>
					<th>模板分类</th>
					<th>模板名称</th>
					<th>模板类型</th>
					<th>类型说明</th>
					<th>提交时间</th>
					<th>操作</th>
				</tr>
			</thead>
		</table>
    </div>
  </div>
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header blue-bg">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">模板上传</h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal" method="post" role="form" id="templetForm" enctype="multipart/form-data">
            <div class="form-group">
              <label class="col-sm-2 control-label no-padding-right">模板分类：</label>
              <div class="col-sm-10">
              		<select id="templetClassify" name="templetClassify" class="form-control shift-info" placeholder="模板分类不存在可直接录入">
					</select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label no-padding-right">模板名称：</label>
              <div class="col-sm-10"><input type="text" id="templetName" name="templetName" class="form-control" placeholder="模板名称"></div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label no-padding-right">模板：</label>
              <div class="col-sm-10">
                <div style="padding-left:0px;" class="col-sm-7"><input type="text" id="templet" style="" class="form-control" placeholder="模板"></div>
                <div class="col-sm-3 floatL">
                  <span class="btn btn-success fileinput-button">
                    <i class="glyphicon glyphicon-plus"></i>
                    <span>上传文件</span>
                    <input id="templetFileNameUpload" type="file" name="templetFileNameUpload" onchange="selectFile();">
                  </span>
                </div>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label no-padding-right">模板类型：</label>
              <div class="col-sm-10">
              	<div style="padding-left:0px;" class="col-sm-7">
              		<select id="templetType" name="templetType" class="form-control" onchange="setJavaFileType(this.value)">
						<option value="java">java</option>
						<option value="jsp">jsp</option>
						<option value="xml">xml</option>
						<option value="js">js</option>
					</select>
				</div>
				<div style="padding-right:0px;" class="col-sm-5">
					<select id="javaFileType" name="javaFileType" class="form-control">
						<option value="controller">controller</option>
						<option value="service">service</option>
						<option value="serviceImpl">serviceImpl</option>
						<option value="mapper">mapper</option>
						<option value="entity">entity</option>
					</select>
					
					<select id="jspFileType" name="jspFileType" class="form-control">
						<option value="List">List页面</option>
						<option value="Add">Add页面</option>
						<option value="Update">Update页面</option>
					</select>
				</div>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label no-padding-right">备注：</label>
              <div class="col-sm-10">
              	<textarea class="form-control" name="remarks" rows="3"></textarea>
              </div>
            </div>
          </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="button default" data-dismiss="modal">取消</button>
        <button type="button" id="dataSourceAdd" onclick="uploadTemplet();"	class="button blue">保存</button>
      </div>
    </div>
  </div>
</div>


<!-- Modal -->
<div class="modal fade" id="uploadTemplet" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header blue-bg">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">重新上传模板</h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal" method="post" role="form" id="uploadTempletForm" enctype="multipart/form-data">
            <input type="hidden" id="idstr" name="id">
            <input type="hidden" id="templetFileNamestr" name="templetFileNamestr">
            <div class="form-group">
              <label class="col-sm-2 control-label no-padding-right">模板：</label>
              <div class="col-sm-10">
                <div style="padding-left:0px;" class="col-sm-7"><input type="text" id="repeatTemplet" style="" class="form-control" placeholder="模板"></div>
                <div class="col-sm-3 floatL">
                  <span class="btn btn-success fileinput-button">
                    <i class="glyphicon glyphicon-plus"></i>
                    <span>上传文件</span>
                    <input id="repeatTempletFileName" type="file" name="repeatTempletFileName" onchange="repeatSelectFile();">
                  </span>
                </div>
              </div>
            </div>
          </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="button default" data-dismiss="modal">取消</button>
        <button type="button" id="dataSourceAdd" onclick="repeatUploadTemplet();"	class="button blue">上传</button>
      </div>
    </div>
  </div>
</div>

</body>
</html>